package com.ten.teacher.factory;

import com.ten.teacher.feign.TbMemberFeign;
import com.ten.common.core.entity.TbMember;
import com.ten.common.core.vo.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author ：Wqw
 * @date ：Created in 2022/11/25 17:56
 * @description： 对远程调用商品的的异常进行兜底处理
 * @modified By：
 * @version:
 */
@Component
@Slf4j
public class TbMemberFeignFactory implements FallbackFactory<TbMemberFeign> {
    @Override
    public TbMemberFeign create(Throwable throwable) {
        return new TbMemberFeign() {
            @Override
            public Result<TbMember> beTeacherByDeleted(String mobile) {
                log.error("会员微服务故障" + throwable.getMessage());
                return new Result<>(500, "会员微服务故障");
            }
        };
    }

}
